<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>创建返校申请</title>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>

    <style type="text/css">

        table {
            margin-left: 3cm;
            margin-top: 1cm;

            width: 18cm;
            height: 300px;


        }

        table.gridtable {
            font-family: verdana, arial, sans-serif;
            font-size: 100%;
            color: #333333;
            border-width: medium;
            border-color: #666666;
            border-collapse: collapse;
            border-style: solid;


        }

        table.gridtable td {
            border-width: medium;
            padding: 8px;
            border-color: #666666;
            background-color: #ffffff;
            border-style: solid;
            width: 100px;
            text-align: center;


        }

        .baseMessage {

        }

        .baseMessage p {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 200%;
            margin-left: 2cm;
            margin-top: 1cm;

        }

        .baseMessage2 {
            font-weight: 600;
            width: 500px;
            height: 50px;
            font-size: 100%;
            float: left;
            margin-left: 0.5cm;


        }

        .baseMessage2 td {

            font-weight: 500;
        }

        input {

            width: 300px;

        }

        reason {
            width: 300px;
            height: 200px;
        }

        button {
            margin-left: 500px;
            width: 95px;
            height: 45px;
            border-radius: 5px;
            color: white;
            background-color: #33CCFF;
        }


    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!-- header -->
    <div th:replace="~{commons/header::header}"></div>

    <!-- left -->
    <div th:replace="~{commons/studentLeft::left}"></div>
    <!-- 内容主体区域 -->
    <div class="layui-body">
        <div style="padding:20px 0px 45px 0px;">

            <div class="baseMessage">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                    <legend>修改请假申请</legend>

                    <div class="baseMessage2" th:each="getStuleaveList2:${getStuleaveList2}">
                        姓名:<span th:text="${getStuleaveList2.getStuName()}"></span>
                    </div>

                    <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                        学号:<span th:text="${getLeaveList2.getStuId()}"></span>
                    </div>
                    <div class="baseMessage2" th:each="getStuleaveList2:${getStuleaveList2}">院系:
                        <td th:text="${getStuleaveList2.getStuCollege()}"></td>
                    </div>
                    <div class="baseMessage2" th:each="getStuleaveList2:${getStuleaveList2}">
                        专业:<span th:text="${getStuleaveList2.getStuMajor()}"></span>
                    </div>
                    <div class="baseMessage2" th:each="getStuleaveList2:${getStuleaveList2}">
                        班级:<span th:text="${getStuleaveList2.getStuClass()}"></span>
                    </div>

                    <div class="baseMessage2" th:each="getStuleaveList2:${getStuleaveList2}">
                        年级:<span th:text="${getStuleaveList2.getStuGrade()}"></span>
                    </div>

                    <form action="/sr_leave_update" method="post" onsubmit="return dateForm();" name="myform"
                          autocomplete="off">

                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            请假原因：<input type="text" name="LeaveReason" th:value="${getLeaveList2.getLeaveReason()}"
                                        required>
                        </div>

                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            去向:<input type="text" name="LeaveDestination"
                                      th:value="${getLeaveList2.getLeaveDestination()}">
                        </div>
                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            申请时间:<input type="date" name="LeaveApplytime"
                                        th:value="${getLeaveList2.getLeaveApplytime()}" required>
                        </div>
                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            请假时间:<input type="date" name="LeaveTime" th:value="${getLeaveList2.getLeaveTime()}"
                                        required>
                            <input type="date" name="LeaveTime2" th:value="${getLeaveList2.getLeaveTime2()}" required>
                        </div>
                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            审批流程:<span th:if="${getLeaveList2.getLeaveApplystate()}==1">审核中</span>
                        </div>
                        <div class="baseMessage2" th:each="getLeaveList2:${getLeaveList2}">
                            <input type="hidden" name="num" th:value="${getLeaveList2.getLeaveNum()}">
                        </div>
                        <input type="submit" value="保存">
                    </form>
                </fieldset>

            </div>
        </div>
    </div>
</div>

<script th:src="@{/layui/layui.js}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });
</script>
<script>
    function dateForm() {
        // var leaveApplytime = document.forms["myform"]["LeaveApplytime"].value;
        var leaveTime = document.forms["myform"]["LeaveTime"].value;
        var leaveTimeEnd = document.forms["myform"]["LeaveTime2"].value;
        // var date = new Date();
        // var seperator1 = "-";
        // var year = date.getFullYear();
        // var month = date.getMonth() + 1;
        // var day = date.getDate();
        // var currentdate = year + seperator1 + 0 + month + seperator1 + 0 + day;

        // if (leaveApplytime > currentdate) {
        //     alert("申请时间不可晚于当前时间");
        //     return false;
         if (leaveTime > leaveTimeEnd) {
            alert("请假结束时间需晚于请假开始时间");
            return false;
        } else {
            alert("新建成功");
            return true;
        }


    }
</script>
</body>
</html>